﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NUnit.Framework;
using AL100.BankApplication.BLL;

namespace AL100.BankApplication.Tests
{
    [TestFixture]
    class Test_Strategies
    {

        AccountTestWithdrawStrategy _strategy;

        /// <summary>
        /// This method is executed once before each test of this class.
        /// </summary>
        [SetUp]
        public void SetUp()
        {
            // Creates the strategy used throughout this class's tests.
            _strategy = new AccountTestWithdrawStrategy();
        }



        [Test]
        public void Test_AccountTestWithdrawStrategy_ForSimple()
        {
            // Creates a SimpleAccount (because deposit is between 0 & 1000).
            var account = Bank.Instance().CreateAccount("titi", "toto", 100);

            // Tells the account to run the Strategy..
            account.RunStrategy(_strategy);

            // Let's test that 1 € has been withdrawn from the SimpleAccount.
            Assert.AreEqual(account.Balance, 99);

        }

        [Test]
        public void Test_AccountTestWithdrawStrategy_ForSilver()
        {
            // Creates a SilverAccount (because deposit is between 1000 & 2000).
            var account = Bank.Instance().CreateAccount("titi", "toto", 1100);
                        
            // Tells the account to run the Strategy..
            account.RunStrategy(_strategy);

            // Let's test that 1 € has been withdrawn from the SimpleAccount.
            Assert.AreEqual(account.Balance, 1098);

        }


        [Test]
        public void Test_AccountTestWithdrawStrategy_ForGold()
        {
            // Creates a GoldAccount (because deposit is over 3000).
            var account = Bank.Instance().CreateAccount("titi", "toto", 3100);

            // Tells the account to run the Strategy..
            account.RunStrategy(_strategy);

            // Let's test that 1 € has been withdrawn from the SimpleAccount.
            Assert.AreEqual(account.Balance, 3097);

        }



















    }
}
